#pragma once
#include <Rz/IObject.h>
#include <Rz/Graphics/Render/IRenderDevice.h>
#include <Rz/Graphics/Render/IDeviceResource.h>
#include "IBindableResource.h"

namespace Rz { namespace Graphics { namespace Render {

enum class TextureAddressMode
{
	Wrap,
	Clamp,
	Mirror
};

enum class TextureFilter
{
	Linear,
	Point,
	Anisotropic,
	LinearMipPoint,
	PointMipLinear,
	MinLinearMagPointMipLinear,
	MinLinearMagPointMipPoint,
	MinPointMagLinearMipLinear,
	MinPointMagLinearMipPoint
};

class ISamplerState :
	virtual public IObject,
	virtual public IDeviceResource,
	virtual public IBindableResource
{
	public:
		RZ_RTTI_INTERFACE(Rz::Graphics::Render, ISamplerState);
		RZ_RTTI_IMPLEMENTS(IObject, IDeviceResource, IBindableResource);
		RZ_RTTI_END;
		
		virtual void Bind(u32 index) { _isBound = true; }
		virtual void Bind() override { _isBound = true; }
		virtual void Unbind() override { _isBound = false; }

		virtual bool IsBound() const { return _isBound; }

		virtual TextureAddressMode GetAddressU() const { return _addressU; }
		virtual void SetAddressU(TextureAddressMode address) { _addressU = address; }

		virtual TextureAddressMode GetAddressV() const { return _addressU; }
		virtual void SetAddressV(TextureAddressMode address) { _addressV = address; }

		virtual TextureAddressMode GetAddressW() const { return _addressU; }
		virtual void SetAddressW(TextureAddressMode address) { _addressW = address; }

		virtual TextureFilter GetFilter() const { return _filter; }
		virtual void SetFilter(TextureFilter filter) { _filter = filter; }

// 		virtual s32 GetMaxAnisotropy() const { return _maxAnisotropy; }
// 		virtual void SetMaxAnisotropy(s32 maxAnisotropy) { _maxAnisotropy = maxAnisotropy; }
// 
// 		virtual s32 GetMaxMipLevel() const { return _maxMipLevel; }
// 		virtual void SetMaxMipLevel(s32 maxMipLevel) { _maxMipLevel = maxMipLevel; }
// 
// 		virtual f32 GetMipMapLevelOfDetailBias() const { return _mipMapLevelOfDetailBias; }
// 		virtual void SetMipMapLevelOfDetailBias(f32 mipMapLevelOfDetailBias) { _mipMapLevelOfDetailBias = mipMapLevelOfDetailBias; }

	protected:
		ISamplerState()
			: _isBound(false)

			, _addressU(TextureAddressMode::Wrap)
			, _addressV(TextureAddressMode::Wrap)
			, _addressW(TextureAddressMode::Wrap)

			, _filter(TextureFilter::Linear)

// 			_maxAnisotropy(0),
// 			_maxMipLevel(0),
// 
// 			_mipMapLevelOfDetailBias(0.0f)
		{

		}

	private:
		bool _isBound;

		TextureAddressMode _addressU;
		TextureAddressMode _addressV;
		TextureAddressMode _addressW;

		TextureFilter _filter;

// 		s32 _maxAnisotropy;
// 		s32 _maxMipLevel;
// 
// 		f32 _mipMapLevelOfDetailBias;
};

} } }
